Python enable arm operationtemplates tests - #11697
Conversation
commit: |
There was a problem hiding this comment.
Pull request overview
This PR re-enables the Azure ARM operation-templates mock API tests (sync + async) in the @typespec/http-client-python package by removing the spec from the regeneration skip list and aligning CI pylint suppressions with the upstream configuration referenced in the PR description.
Changes:
- Un-comment and enable sync/async pytest suites for Azure ARM operation templates.
- Stop skipping the
azure/resource-manager/operation-templatesspec during regeneration. - Add a per-package pylint disable for the generated
azure-resource-manager-operation-templatespackage and include a Chronus entry.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/http-client-python/tests/mock_api/azure/test_azure_arm_operationtemplates.py | Enables sync ARM operation templates tests (needs a small iterator fix + boolean assertion style tweak). |
| packages/http-client-python/tests/mock_api/azure/asynctests/test_azure_arm_operationtemplates_async.py | Enables async ARM operation templates tests (boolean assertion style tweak). |
| packages/http-client-python/eng/scripts/ci/run_pylint.py | Adds per-package pylint disable for too-many-statements for the operation templates generated package. |
| packages/http-client-python/eng/scripts/ci/regenerate-common.ts | Removes operation-templates from SKIP_SPECS so it will be regenerated and tested. |
| .chronus/changes/python-enable-arm-operationtemplates-tests-2026-08-17.md | Adds an internal changelog entry documenting the test enablement. |
Suppressed comments (2)
packages/http-client-python/tests/mock_api/azure/asynctests/test_azure_arm_operationtemplates_async.py:45
- Avoid comparing booleans with
== False; pylint commonly flags this and it can hide non-bool falsy values. Preferis False(orassert not ...when appropriate).
result = await client.check_name_availability.check_local(
location="westus",
body=models.CheckNameAvailabilityRequest(name="checkName", type="Microsoft.Web/site"),
)
assert result.name_available == False
assert result.reason == models.CheckNameAvailabilityReason.ALREADY_EXISTS
assert result.message == "Hostname 'checkName' already exists. Please select a different name."
packages/http-client-python/tests/mock_api/azure/test_azure_arm_operationtemplates.py:40
- Avoid comparing booleans with
== False; pylint commonly flags this and it can hide non-bool falsy values. Preferis False(orassert not ...when appropriate).
assert result.name_available == False
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
All changed packages have been documented.
Show changes
|
|
You can try these changes here
|
Python emitter diffBaseline Diff summary: 49 file(s), +14451 / -0 Rendered diff: inline on the run summary, or the emitter-diff-html artifact. Informational check (eng/emitter-diff); does not block the PR. |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.
Suppressed comments (2)
packages/http-client-python/tests/mock_api/azure/test_azure_arm_operationtemplates.py:47
client.operations.list()returns an iterator/pager; calling.next()is not a valid Python 3 iteration pattern and is inconsistent with other ARM tests in this suite. Usenext(iter(...))(or materialize a list) so the test reliably retrieves the first item.
def test_operations_list(client):
result = client.operations.list().next()
assert result.name == "Microsoft.Compute/virtualMachines/write"
packages/http-client-python/tests/mock_api/azure/asynctests/test_azure_arm_operationtemplates_async.py:55
- This test will pass vacuously if
client.operations.list()yields no items because all assertions are inside theasync forloop. Collect at least one item (as done in other async ARM tests) and assert the list is non-empty before validating fields.
async def test_operations_list(client):
result = client.operations.list()
async for operation in result:
assert operation.name == "Microsoft.Compute/virtualMachines/write"
assert operation.display.operation == "Create or Update Virtual Machine."
assert operation.origin == "user,system"
assert operation.action_type == "Internal"
sync ci configuration with https://github.com/Azure/typespec-azure/blob/7c0c271f206bed1937962ca12b920e555588995e/packages/typespec-python/eng/scripts/ci/run_pylint.py#L55